<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户列表')" />
    <th:block th:include="include :: layout-latest-css" />
    <th:block th:include="include :: ztree-css" />
</head>
<style>
    #bootstrap-table > tbody > tr > td:last-child {
        display: flex;
        justify-content: space-between;
        justify-items: center;
        align-items: center;
        flex-wrap: wrap;
        width: 200px;
    }

    #bootstrap-table > tbody > tr > td .btn {
        margin: 3px;
    }
</style>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="user-form">
                    <input type="hidden" id="deptId" name="deptId">
                    <input type="hidden" id="parentId" name="parentId">
                    <input type="hidden" name="userType" value="1" />
                    <div class="select-list">
                        <ul>
                            <li>
                                用户id：<input type="text" name="userId" />
                            </li>
                            <li>
                                关键词：<input type="text" name="key" />
                            </li>
                            <li>
                                身份证号：<input type="text" name="idCardNum" />
                            </li>

                            <li>
                                <p>用户类型：</p>
                                <select name="userType1" th:with="type=${@dict.getType('user_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>

                            <li>
                                <p>服务费：</p>
                                <select name="serverFlag">
                                    <option value="">所有</option>
                                    <option value="1">收取</option>
                                    <option value="0">不收取</option>
                                </select>
                            </li>
                            <li>
                                <p>封禁状态：</p>
                                <select name="email">
                                    <option value="">所有</option>
                                    <option value="0">正常</option>
                                    <option value="1">后台封禁</option>
                                    <option value="3">缓存封禁</option>
                                </select>
                            </li>
                            <li>
                                <p>推广员：</p>
                                <select name="spreadFlag" th:with="type=${@dict.getType('no_yes')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                用户状态：<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                            </li>
                            <li>
                                <p>用户标记：</p>
                                <select name="userMark" th:with="type=${@dict.getType('user_mark')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>创建时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]" />
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]" />
                            </li>
                            <li class="select-time">
                                <label>最后登陆时间： </label>
                                <input type="text" class="time-input" id="loginDate" placeholder="开始时间" name="params[loginDate]" />
                                <span>-</span>
                                <input type="text" class="time-input" id="endloginDate" placeholder="结束时间" name="params[endloginDate]" />
                            </li>

                            <li>
                                <label>是否发单[导出]：</label>
                                <select name="params[isfd]" th:with="type=${@dict.getType('no_yes')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>是否接单[导出]：</label>
                                <select name="params[isjd]" th:with="type=${@dict.getType('no_yes')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>登陆统计时间[导出]： </label>
                                <input type="text" class="time-input" id="signInDate" placeholder="开始时间" name="params[signInDate]" />
                                <span>-</span>
                                <input type="text" class="time-input" id="endSignInDate" placeholder="结束时间" name="params[endSignInDate]" />
                            </li>
                            <li class="select-time">
                                <label>登陆统计次数[导出]： </label>
                                <input type="number" id="signInStartCount" placeholder="开始次数" name="params[signInStartCount]" />
                                <span>-</span>
                                <input type="number" id="signInEndCount" placeholder="结束次数" name="params[signInEndCount]" />
                            </li>
                            <li>
                                <label>是否有优惠卷[导出]： </label>
                                <select name="params[hasCoupon]">
                                    <option value="">所有</option>
                                    <option value="0">无</option>
                                    <option value="1">有</option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>登陆统计时间[导出]： </label>
                                <input type="text" class="time-input" id="signInDate" placeholder="开始时间" name="params[signInDate]" />
                                <span>-</span>
                                <input type="text" class="time-input" id="endSignInDate" placeholder="结束时间" name="params[endSignInDate]" />
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="editCoupons()" shiro:hasPermission="bajiaostar:coupon:add">
                    <i class="fa fa-plus"></i> 添加优惠卷
                </a>
                <a class="btn btn-danger multiple disabled" onclick="removeCancel()" shiro:hasPermission="system:user:edit">
                    <i class="fa fa-remove"></i> 解除多次取消封禁
                </a>
                <a class="btn btn-warning" onclick="addCancel()" shiro:hasPermission="system:user:edit">
                    <i class="fa fa-remove"></i> 封禁账号
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:user:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" data-mobile-responsive="true"></table>
            </div>
        </div>
    </div>
</div>

<th:block th:include="include :: footer" />
<th:block th:include="include :: layout-latest-js" />
<th:block th:include="include :: ztree-js" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:user:remove')}]];
    var resetPwdFlag = [[${@permission.hasPermi('system:user:resetPwd')}]];
    var userTypeDatas = [[${@dict.getType('user_type')}]];
    var userMarkDatas = [[${@dict.getType('user_mark')}]];
    var couponFlag = [[${@permission.hasPermi('bajiaostar:coupon:add')}]];
    var swtichusertypelag = [[${@permission.hasPermi('system:user:swtichusertype')}]];
    var switchUserAmountFlag = [[${@permission.hasPermi('system:user:switchUserAmount')}]];
    var updateUserIdentityIndexFlag = [[${@permission.hasPermi('system:user:updateUserIdentityIndex')}]];
    var upUrl = [[${upUrl}]];
    var prefix = ctx + "system/user";
    var yesNoDatas = [[${@dict.getType('no_yes')}]];
    $(function () {
        var panehHidden = false;
        if ($(this).width() < 769) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 185});
        queryUserList();
        queryDeptTree();
    });

    function queryUserList() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/common_edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            importUrl: prefix + "/importData",
            importTemplateUrl: prefix + "/importTemplate",
            sortName: "createTime",
            sortOrder: "desc",
            modalName: "用户",
            columns: [{
                checkbox: true
            },
                {
                    field: 'userId',
                    title: '用户ID'
                },
                {
                    field: 'avatar',
                    title: '用户头像',
                    formatter: function (value, row, index) {
                        if (value.indexOf("http") >= 0) {
                            return $.table.imageView(value);
                        } else {
                            var url = upUrl.toString() + value;
                            return $.table.imageView1(url);
                        }
                    }
                },

                {
                    field: 'loginName',
                    title: '登录名称',
                    sortable: true
                },
                {
                    field: 'userName',
                    title: '用户名称'
                },
                {
                    field: 'userType',
                    title: '用户类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(userTypeDatas, value);
                    }
                },
                {
                    field: 'userIdentityStatus',
                    title: '用户身份',
                    formatter: function (value, row, index) {
                        if (row.userIdentityStatus == 0) {
                            return "试用";
                        } else if (row.userIdentityStatus == 1) {
                            return "正式";
                        } else if (row.userIdentityStatus == 2) {
                            return "金牌";
                        }
                    }
                },
                {
                    field: 'issuanceNum',
                    title: '发单量'
                },
                {
                    field: 'receiveNum',
                    title: '接单量'

                },
                {
                    visible: editFlag == 'hidden' ? false : true,
                    title: '封禁状态',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return banStatusTools(row);
                    }
                },
                {
                    visible: editFlag == 'hidden' ? false : true,
                    title: '推广员标识',
                    align: 'center',
                    visible: false,
                    formatter: function (value, row, index) {
                        return spreadFlagTools(row);
                    }
                },
                {
                    visible: editFlag == 'hidden' ? false : true,
                    title: '服务费标识',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return serverFlagTools(row);
                    }
                },
                {
                    field: 'cardType',
                    title: '开启直通卡',
                    formatter: function (value, row, index) {
                        return banStatusToolsbate(row);
                    }
                },

                {
                    visible: editFlag == 'hidden' ? false : true,
                    title: '金牌临时工',
                    align: 'center',
                    formatter: function (value, row, index) {
                        //	console.log(row);
                        return vipFlagTools(row);
                    }
                },
                {
                    field: 'userMark',
                    title: '用户标记',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(userMarkDatas, value);
                    }
                },
                {
                    visible: editFlag == 'hidden' ? false : true,
                    title: '身份验证开关',
                    align: 'center',
                    visible: false,
                    formatter: function (value, row, index) {
                        return authSwitchTools(row);
                    }
                },
                {
                    field: 'cardNumber',
                    title: '可用人数',
                    visible: false
                },
                {
                    field: 'cardUserType',
                    title: '直通卡类型',
                    visible: false,
                    formatter: function (value, row, index) {
                        /* console.log(row); */
                        if (row.cardUserType == 0) {
                            return "未开通";
                        } else if (row.cardUserType == 1) {
                            return "月卡";
                        } else if (row.cardUserType == 2) {
                            return "半年卡";
                        } else if (row.cardUserType == 3) {
                            return "年卡";
                        } else {
                            return "体验卡";
                        }
                    }
                },
                {
                    field: 'bdFlagName',
                    title: 'BD推广',
                    align: 'center',
                    visible: false
                },
                {
                    field: 'cardtime',
                    title: '截止时间',
                    align: 'center',
                    visible: false
                },

                {
                    field: 'createTime',
                    title: '创建时间',
                    sortable: true
                },
                {
                    field: 'email',
                    title: '封禁时间',
                    visible: false,
                },
                {
                    field: 'loginDate',
                    title: '最后登陆时间',
                    visible: false,
                },
                {
                    field: 'vipEndTime',
                    title: '金牌到期时间',
                    visible: false,
                },
                {
                    field: 'channel',
                    title: '渠道',
                    formatter: function (value, row, index) {
                        if (value == "" || value == null) {
                            return "无";
                        } else {
                            return value;
                        }
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.userId + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a> ');
                        actions.push('<a class="btn btn-info btn-xs ' + resetPwdFlag + '" href="javascript:void(0)" onclick="resetPwd(\'' + row.userId + '\')"><i class="fa fa-key"></i>重置</a> ');
                        actions.push('<a class="btn btn-info btn-xs ' + swtichusertypelag + '" href="javascript:void(0)" onclick="switchUserType(\'' + row.userId + '\')"><i class="fa fa-key"></i>切换用户类型</a> ');
                        actions.push('<a class="btn btn-primary btn-xs ' + couponFlag + '" href="javascript:void(0)" onclick="editCoupon(\'' + row.userId + '\')">赠送优惠卷</a> ');
                        actions.push('<a class="btn btn-info btn-xs ' + switchUserAmountFlag + '" href="javascript:void(0)" onclick="switchUserAmount(\'' + row.userId + '\')"><i class="fa fa-key"></i>加减余额</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + updateUserIdentityIndexFlag + '" href="javascript:void(0)" onclick="updateUserIdentityIndex(\'' + row.userId + '\')"><i class="fa fa-key"></i>身份变更</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    }

    function editCoupon(id) {
        $.modal.open("赠送优惠卷", prefix + "/add_coupon/" + id);
    }

    function editCoupons() {
        $.modal.open("赠送优惠卷", prefix + "/add_coupons");
    }

    function queryDeptTree() {
        var url = ctx + "system/dept/treeData";
        var options = {
            url: url,
            expandLevel: 2,
            onClick: zOnClick
        };
        $.tree.init(options);

        function zOnClick(event, treeId, treeNode) {
            $("#deptId").val(treeNode.id);
            $("#parentId").val(treeNode.pId);
            $.table.search();
        }
    }

    $('#btnExpand').click(function () {
        $._tree.expandAll(true);
        $(this).hide();
        $('#btnCollapse').show();
    });

    $('#btnCollapse').click(function () {
        $._tree.expandAll(false);
        $(this).hide();
        $('#btnExpand').show();
    });

    $('#btnRefresh').click(function () {
        queryDeptTree();
    });

    /* 用户管理-部门 */
    function dept() {
        var url = ctx + "system/dept";
        $.modal.openTab("部门管理", url);
    }

    /* 用户管理-重置密码 */
    function resetPwd(userId) {
        var url = prefix + '/resetPwd/' + userId;
        $.modal.open("重置密码", url, '800', '300');
    }

    /* 用户管理-切换用户类型 */
    function switchUserType(userId) {
        var url = prefix + '/switchUserType/' + userId;
        $.modal.open("切换用户类型", url, '800', '300');
    }

    //加减用户余额
    function switchUserAmount(userId) {
        var url = prefix + '/switchUserAmount/' + userId;
        $.modal.open("加减用户余额", url, '800', '300');
    }

    //变更用户身份
    function updateUserIdentityIndex(userId) {
        var url = prefix + '/updateUserIdentityIndex/' + userId;
        $.modal.open("变更用户身份", url, '800', '500');
    }

    function updSpreadFlag(userId) {
        var url = prefix + '/updSpreadFlag/' + userId;
        $.modal.open("切换用户类型", url, '800', '300');
    }


    /* 用户状态显示 */
    function statusTools(row) {
        if (row.status == 1) {
            return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.userId + '\')"></i> ';
        } else {
            return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.userId + '\')"></i> ';
        }
    }

    function banStatusTools(row) {
        if (row.banStatus == 1) {
            return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="cancelBanStatus(\'' + row.userId + '\')"></i> ';
        } else {
            return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="banStatus(\'' + row.userId + '\')"></i> ';
        }
    }

    function banStatusToolsbate(row) {
        if (row.cardType == 1) {//关闭
            return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="cancelBanStatusbate(\'' + row.userId + '\')"></i> ';
        } else {//开启
            return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="banStatusbate(\'' + row.userId + '\')"></i> ';
        }
    }

    function spreadFlagTools(row) {
        if (row.spreadFlag == 0) {
            return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="setSpreadFlag(\'' + row.userId + '\')"></i> ';
        } else {
            return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="cancelSpreadFlag(\'' + row.userId + '\')"></i> ';
        }
    }

    function serverFlagTools(row) {
        if (row.serverFlag == 0) {
            return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="setServerFlag(\'' + row.userId + '\')"></i> ';
        } else {
            return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="cancelServerFlag(\'' + row.userId + '\')"></i> ';
        }
    }

    function serverFlagToolss(row) {
        if (row.level != 2) {
            return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="setServerFlags(\'' + row.userId + '\')"></i> ';
        } else {
            return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="cancelServerFlags(\'' + row.userId + '\')"></i> ';
        }
    }

    function vipFlagTools(row) {
        if (row.vipFlag == 0) {
            return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="setVipFlag(\'' + row.userId + '\')"></i> ';
        } else {
            return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="cancelVipFlag(\'' + row.userId + '\')"></i> ';
        }
    }

    function authSwitchTools(row) {
        if (row.authSwitch == 0) {
            return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="setAuthSwitch(\'' + row.userId + '\')"></i> ';
        } else {
            return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="cancelAuthSwitch(\'' + row.userId + '\')"></i> ';
        }
    }

    function cardSwitchTools(row) {

        if (row.authSwitch == 0) {
            return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="setcardSwitch(' + row.userId + ',' + row.userType + ')"></i> ';
        } else {
            return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="getcardSwitch(' + row.userId + ',' + row.userType + ')"></i> ';
        }
    }

    /* 用户管理-停用 */
    function disable(userId) {
        $.modal.confirm("确认要停用用户吗？", function () {
            $.operate.post(prefix + "/changeStatus", {"userId": userId, "status": 1});
        })
    }

    /* 用户管理启用 */
    function enable(userId) {
        $.modal.confirm("确认要启用用户吗？", function () {
            $.operate.post(prefix + "/changeStatus", {"userId": userId, "status": 0});
        })
    }

    /* 用户管理-取消设置推广员 */
    function cancelSpreadFlag(userId) {
        $.modal.confirm("确认要取消设置吗？", function () {
            $.operate.post(prefix + "/updSpreadFlag", {"userId": userId, "spreadFlag": 0});
        })
    }

    /* 用户管理-设置为推广员*/
    function setSpreadFlag(userId) {
        $.modal.confirm("确认要设置为推广员吗？", function () {
            $.operate.post(prefix + "/updSpreadFlag", {"userId": userId, "spreadFlag": 1});
        })
    }

    /* 用户管理-取消设置服务收费 type 0 服务 1 vip 2 身份认证开关*/
    function cancelServerFlag(userId) {
        $.modal.confirm("确认要取消设置吗？", function () {
            $.operate.post(prefix + "/updFlag", {"userId": userId, "flag": 0, "type": 0});
        })
    }

    function cancelServerFlags(userId) {
        $.operate.post(prefix + "/updFlags", {"userId": userId, "flag": 0, "type": 1});
        //$.modal.confirm("确认要取消设置吗？", function() {
        //	$.operate.post(prefix + "/updFlags", { "userId": userId, "flag": 0 ,"type": 1});
        //})
    }

    /* 用户管理-设置为服务收费*/
    function setServerFlag(userId) {
        $.operate.post(prefix + "/updFlag", {"userId": userId, "flag": 1, "type": 0});
        //$.modal.confirm("确认要设置为服务收费吗？", function() {
        //var msg = prompt("请输入密码~：", "");
        //if("qwert222"==msg){
        //$.operate.post(prefix + "/updFlag", { "userId": userId, "flag": 1,"type": 0 });
        //}else{
        //	alert("密码错误！");
        //}
        //})
    }

    /* 用户管理-设置为服务收费*/
    function setServerFlags(userId) {
        $.modal.confirm("确认要设置二级用户吗？", function () {
            $.operate.post(prefix + "/updFlags", {"userId": userId, "flag": 1, "type": 2});
        })
    }

    /* 用户管理-取消Vip */
    function cancelVipFlag(userId) {
        $.modal.confirm("确认要取消设置吗？", function () {
            $.operate.post(prefix + "/updFlag", {"userId": userId, "flag": 0, "type": 1});
        })
    }

    /* 用户管理-设置为Vip*/
    function setVipFlag(userId) {
        $.modal.confirm("确认要设置为VIP吗？", function () {
            $.operate.post(prefix + "/updFlag", {"userId": userId, "flag": 1, "type": 1});
        })
    }

    /* 用户管理-取消身份验证 */
    function cancelAuthSwitch(userId) {
        $.modal.confirm("确认要取消身份验证设置吗？", function () {
            $.operate.post(prefix + "/updFlag", {"userId": userId, "flag": 0, "type": 2});
        })
    }

    /* 用户管理-设置为身份验证*/
    function setAuthSwitch(userId) {
        $.modal.confirm("确认要身份验证设置吗？", function () {
            $.operate.post(prefix + "/updFlag", {"userId": userId, "flag": 1, "type": 2});
        })
    }

    /* 用户管理-设置为卡片用户*/
    function setcardSwitch(userId, userType) {
        if (userType == 0) {
            return $.modal.confirm("雇员不可开卡");
        }
        $.modal.open("赠送优惠卷", prefix + "/updosage/" + userId);
        /* 	$.modal.confirm("确认要开卡吗？", function() {
                $.operate.post(prefix + "/updosage", { "userId": userId});
        })*/
    }

    /* 用户管理-设置为卡片用户*/
    function getcardSwitch(userId) {
        $.modal.confirm("确认要关闭卡吗？", function () {
            /*	$.operate.post(prefix + "/updFlag", { "userId": userId, "flag": 1 ,"type": 2 });*/
        })
    }

    /* 用户管理-取消封禁 */
    function cancelBanStatus(userId) {
        $.modal.confirm("确认要取消封禁吗？", function () {
            $.operate.post(prefix + "/updBanStatus", {"userId": userId, "banStatus": 0});
        })
    }

    function cancelBanStatusbate(userId) {

        $.modal.confirm("确认要关闭直通卡支付吗？", function () {
            $.operate.post(prefix + "/updBanStatusbate", {"userId": userId, "banStatus": 0});
        })
    }

    /* 用户管理-封禁*/
    function banStatusbate(userId) {
        $.modal.confirm("确认要开启直通卡支付吗？", function () {
            $.operate.post(prefix + "/updBanStatusbate", {"userId": userId, "banStatus": 1});
        })
    }

    /* 用户管理-封禁*/
    function banStatus(userId) {
        $.modal.confirm("确认要封禁吗？", function () {
            $.operate.post(prefix + "/updBanStatus", {"userId": userId, "banStatus": 1});
        })
    }


    function removeCancel() {
        var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId);
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.confirm("确认要解除选中的" + rows.length + "条多次取消封禁数据吗?", function () {
            var url = prefix + "/remove_cancel";
            var data = {"ids": rows.join()};
            $.operate.submit(url, "post", "json", data);
        });
    }

    function addCancel() {
        var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId);
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        /*var value=prompt("封禁天数");
        if(value == "" || value == null) {// 如果取消输入则会返回null

        }else{
            var url = prefix + "/add_cancel";
            var data = { "ids": rows.join(),"time": value};
            $.operate.submit(url, "post", "json", data);

        } */

        var url = prefix + '/switchUserfenjins/' + rows.join();
        $.modal.open("封禁用户", url, '800', '300');
    }
</script>
</body>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file" />
            <div class="mt10 pt5">
                <input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据
                &nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</html>